package model;
/**
 * @author Darko Martinovikj
 * @version 1.0 21.02.2012
 * 
 * Class representing one transition of a graph without variables
 *  */
public class EdgeTransitionSystem {
	
	private NodeTransitionSystem fromNode;
	private String transitionName;
	private NodeTransitionSystem toNode;
	
	/**
	 * This method is the constructor of the class.
	 * 
	 * @param GraphNode from - the start node of the transition
	 * @param String guardString - the guard stored as string
	 * @param String actionString - the actions performed stored as string
	 * @param String transitionName - the name of the transition
	 * @param GraphNode to - the end node of the transition
	 */
	public EdgeTransitionSystem(NodeTransitionSystem from, String transitionName, NodeTransitionSystem to) {
		this.fromNode = from;
		this.transitionName = transitionName;
		this.toNode = to;
	}

	/**
	 * This method is used to access the start node of the edge
	 *
	 * @return GraphNode - the start node
	 */
	public NodeTransitionSystem getFromNode() {
		return fromNode;
	}

	/**
	 * This method is used to access the name of the transition
	 *
	 * @return String - the transition name
	 */
	public String getTransitionName() {
		return transitionName;
	}

	/**
	 * This method is used to access the end node of the edge
	 *
	 * @return GraphNode - the end node
	 */
	public NodeTransitionSystem getToNode() {
		return toNode;
	}
	
	/**
	 * This method is used to print the edge information
	 *
	 * @return String- String containing the edge information
	 */
	@Override
	public String toString(){
		return "["+fromNode+" "+transitionName+" "+toNode+"]";
	}
	

	/**This method compares if two edges are equal
	 * 
	 * @param Object o2 - the second edge
	 * @return Boolean - true if they are equal or false if they aren't 
	 */
	@Override
	public boolean equals(Object o2){
		EdgeTransitionSystem edge=(EdgeTransitionSystem)o2;
		if(this.fromNode.equals(edge.fromNode)&&this.toNode.equals(edge.toNode)&&this.transitionName.equals(edge.transitionName))
			return true;
		else
			return false;
	}
}
